package controller;

import util.JdbcUtils;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author gaojie  gao4433@qq.com
 * @Description
 * @date 2022/6/9 16:59
 * @since 1.8
 */
public class CategoryAddServlet extends HttpServlet {

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        String categoryName = request.getParameter("categoryName");

        String sql = "INSERT INTO `ec_simple_category` (`name`) VALUES(?)";
        int modify = JdbcUtils.modify(sql, categoryName);
    }
}
